#include <iostream>
#include <map>
#include <vector>
using namespace std;
class Solution {
   public:
    vector<int> twoSum(vector<int>& nums, int target) {
        map<int, int> mp;
        vector<int> res(2);
        for (int n : nums) {
            if (mp.find(n) != mp.end()) {
                mp[n]++;
            } else {
                mp.insert(pair<int, int>(n, 1));
            }
        }
        if (target % 2 == 0 && mp.find(target / 2) != mp.end()) {
            if (mp[target / 2] >= 2) {
                res[0] = target / 2;
                res[1] = target / 2;
                return res;
            }
        }
        for (int n : nums) {
            int m = target - n;
            if (mp.find(m) != mp.end()) {
                res[0] = n;
                res[1] = m;
                return res;
            }
        }
        return res;
    }
};
int main() {
    return 0;
}
